class Solution:
    def mix(self, s1, s2):
        r = ''
        for i1, i2 in zip(s1, s2):
            r += i1
            r += i2
        if len(s1) != len(s2):
            r += s1[-1]
        return r

    def convert(self, s: str, numRows: int) -> str:
        if numRows == 1:
            return s
        ret = s[::2*(numRows-1)]
        if numRows >= 2:
            for i in range(numRows - 2):
                n = i + 1
                ret += self.mix(s[n::2*(numRows-1)], s[2*(numRows-1)-n::2*(numRows-1)])
        if numRows >= 1:
            ret += s[numRows-1::2*(numRows-1)]
        return ret
